package com.ejb.otherUtil;

import java.io.IOException;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

@ManagedBean(name = "logoutBean")
@SessionScoped
public class LogoutBean
{

    public void logout()
    {

	FacesContext context = FacesContext.getCurrentInstance();
	HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
	
	request.getSession().invalidate();
	
	try
	{
	    context.getExternalContext().redirect(request.getContextPath());
	    //return "/index?faces-redirect=true";
	} catch (IOException e){}
    }
}
